package com.ly.report_ah.controller;


import com.ly.report_ah.entity.master.Company;
import com.ly.report_ah.sercive.master.ReportService;
import com.ly.report_ah.vo.ReportVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@CrossOrigin
public class ReportController {


    @Autowired
    ReportService reportServiceImpl;


    @GetMapping("/report/{company_id}/{type}/{yearMonth}")
    public ReportVO getReportVO(@PathVariable("company_id") String company_id,@PathVariable("yearMonth") Long yearMonth,@PathVariable("type") String type){

        return this.reportServiceImpl.getReportVO(company_id,yearMonth,type);
    }


    @GetMapping("/summary/{company_id}/{yearMonth}")
    public Boolean summaryData(@PathVariable("company_id") String company_id,@PathVariable("yearMonth") Long yearMonth ){

        Integer integer = this.reportServiceImpl.summaryData(company_id);
        return integer > 0;
    }



}
